import request from '../../../utils/request'
// 查询栏目列表
export function list (query) {
  return request({
    url: '/system/cms/menu/list',
    method: 'get',
    params: query
  })
}

// 查询栏目模型选型
export function getModelOption () {
  return request({
    url: '/system/cms/menu/modelOptions',
    method: 'get'
  })
}
export function treeselect () {
  return request({
    url: '/system/cms/menu/getTreeSelect',
    method: 'get'
  })
}

export function sortMenu (params) {
  return request({
    url: '/system/cms/menu/sort',
    method: 'post',
    data: params
  })
}
// 添加栏目操作
export function addMenu (params) {
  return request({
    url: '/system/cms/menu/addMenu',
    method: 'post',
    data: params
  })
}
// 获取修改数据
export function getMenuById (id) {
  return request({
    url: '/system/cms/menu/getMenuById?id=' + id,
    method: 'get'
  })
}
export function updateMenu (data) {
  return request({
    url: '/system/cms/menu/updateCmsCategory',
    method: 'post',
    data: data
  })
}
// 删除栏目
export function delMenu (id) {
  let ids = []
  if (!Array.isArray(id)) {
    ids.push(id)
  } else {
    ids = id
  }
  return request({
    url: '/system/cms/menu/deleteCategory',
    method: 'delete',
    data: ids
  })
}
